PAT-甲级-1005-Spell It Right (20 分)
Updated:
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.
Input Specification:
Each input file contains one test case. Each case occupies one line which contains an N (≤10100).
Output Specification:
For each test case, output in one line the digits of the sum in English words. There must be one space between two consecutive words, but no extra space at the end of a line.
Sample Input:
12345
Sample Output:
one five
题目大意:给一串数字,求出数字之和并用英文打印。
分析:用字符串存储数字,对字符串的每一个数转化为数字加于n,将最后的结果n转化为字符串,再根据字典打印对应的数字即可。
1 |
|